package com.sjf.day01;

import java.util.Arrays;

/**
 * @author <sjf753@qq.com>
 * @since 2021/12/4 10:37
 **/
public class selectSort {
    public static void bubble(int[] num){
        int n= num.length;
        for(int i=0;i<n-1;i++){
            for(int j=0 ;j<n-1-i;j++){
                if(num[j]>num[j+1]){
                    swap(num,j,j+1);
                }
            }
            System.out.println(Arrays.toString(num));
        }
    }
    public static void swap(int[] a,int i,int j){
        a[i] = a[i] ^ a[j];
        a[j] = a[i] ^ a[j];
        a[i] = a[i] ^ a[j];
    }

    public static void main(String[] args) {
        int[] a =new int[]{2,5,3,7,4,9,8};
        bubble(a);
    }
}
